home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shw_bosscinematic.cog < prev    next >
Text File  |  1999-11-15  |  16KB  |  561 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SHW_BossCinematic.cog
  4. #
  5. # Nifty cutscenes for ice boss startup and death
  6. #
  7. # [CM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14. #...............MESSAGES..............
  15.     message      startup
  16.     message      entered
  17.     message      killed
  18.     message      pulse
  19.     message        damaged
  20.     message        user0
  21.  
  22.  
  23. #...............COGS..............
  24.     cog            boss_Cog
  25.  
  26.  
  27. #...............ACTORS..............
  28.     thing        player                                        local
  29.     thing        indyActor                                    
  30.     thing        Ice_Boss                                        
  31.     thing        t_CombatIceBoss                                local                                        
  32.     
  33.     thing        ice_barrier                                    mask=0x408                                                                        
  34.  
  35.  
  36. #...............EVENT LOCATIONS..............
  37.     thing        fragment                                    local    #local thing for debris generation
  38.     thing        dustthing                                    local
  39.     sector        safetySECT                                
  40.  
  41. #...............ACTOR MARKS..............
  42.     thing        in_mv0
  43.     thing        in_mv1
  44.     
  45.     thing        ib_mv0
  46.     thing        ib_mv1
  47.  
  48. #...............TRIGGERS..............
  49.     sector        startsect
  50.  
  51.  
  52. #...............CAMERAS..............
  53.     thing        startCam
  54.     thing        boss_shotPos
  55.     thing        menace_shotPos
  56.     
  57.     thing        shatterCam                                            # imp action camera on the barrier
  58.     thing        damageCam                                    local    # for showing the boss upon damage
  59.     thing        crackshoCam                                            # show barrier crack with this one
  60.     thing        returncampos                                        # come back from intro cutscene
  61.  
  62.  
  63. #...............CAMERA TARGETS..............
  64.     thing        bossCamTarg                                    local                                                                                                         
  65.     thing        menace_shotTarg                                
  66.     
  67.     thing        damageTarg                                    local    # create at boss' position for showing damage                                
  68.     #thing        damageTarg1                                    local 
  69.     thing        shatterTarg                                            # show damage on the ice barrier                                
  70.  
  71.  
  72. #...............KEYFRAMES..............
  73.     keyframe    in_hat=0in_figithat_4_4.key                    local
  74.     keyframe    in_brush=0in_stand1_bd_4.key                local
  75.     keyframe    in_stand4=0in_stand4.key                    local
  76.  
  77.  
  78. #...............VECTORS..............
  79.     vector        bossCamVec                                    local
  80.     vector        vec_pos                                        local
  81.  
  82.  
  83. #...............VARIABLES..............
  84.     int            b_started=0                                       local
  85.     int            start_scene=0                               local
  86.     int            end_scene=0                                   local
  87.     int            animID                                           local
  88.     int            b_spin                                           local
  89.     int            track                                           local
  90.     int            i_shatterable=0                                local
  91.     int            i=0                                            local
  92.     int            crackloop                                    local
  93.     
  94.  
  95. #...............TEMPLATES..............
  96.     template    ghostTpl=ghost                              local
  97.     template    debris=iceshrapa                               local
  98.     template    dust=dustcloud4ever                            local
  99.  
  100. #...............MATERIALS..............
  101.     material    dustmat=gen_a4sfx_dustcloud.mat                local
  102.     material    blockadeskin=ice_4door_frnt.mat                local
  103.  
  104. #...............SOUNDS..............
  105.     sound        in_what=Inxj005.wav                            local
  106.     sound        in_success=INXJ110.wav                        local
  107.     
  108.     sound        enter_cue=mus_gen_fullaction.wav            local
  109.     sound        kill_cue=mus_jep_indyrescue1.wav            local
  110.     sound        relief_cue=mus_gen_indyrelief.wav            local
  111.  
  112.     sound        explosion=imp1_wall_break.wav                local
  113.     sound       sfxCharge=imp1_chargeup.wav                 local
  114.     sound       mus_Eerie=mus_gen_eerie1.wav                local
  115.     
  116.     sound       crackice=pru_boulder_rolling_c.wav             local
  117.  
  118. #...............VECTORS..............
  119.     vector        duststart                                      local
  120.     vector        dustend                                        local
  121.     vector        v_targetpos                                    local
  122.  
  123. end
  124.  
  125. # ========================================================================================
  126. code
  127.  
  128. # ========================================================================================
  129. startup:
  130.  
  131.     AISetCutSceneMode(Ice_Boss);
  132.     player = GetLocalPlayerThing();
  133.     SetSectorAdjoins(safetySECT, 0);
  134.  
  135.     return;
  136.  
  137.  
  138. # ========================================================================================
  139. entered:
  140.  
  141.     If ( (GetSenderRef() == startsect) && (b_started == 0) )
  142.     {
  143.         b_started = 1;
  144.  
  145.         # stop player
  146.         Sleep(0.5);
  147.         MakeMeStop();
  148.         DeselectWeaponWait(player);
  149.  
  150.         # setup actor
  151.         StartCutscene(1);
  152.         CopyPlayerHolsters(player, indyActor);
  153.         CopyOrientAndPos(player, indyActor); 
  154.         SetThingFlags(player, 0x80000);
  155.         ClearThingFlags(indyActor, 0x80000);
  156.         
  157.         # create target for secondary focus at player position.
  158.         bossCamVec = VectorAdd(VectorTransformToOrient(player, '0.0 0.05 0.02'), GetThingPos(player));
  159.         bossCamTarg = CreateThingAtPos(ghostTpl, GetThingSector(player), bossCamVec, '0 0 0');
  160.         CaptureThing(bossCamTarg);
  161.         AttachThingToThing(bossCamTarg, indyActor);
  162.         
  163.  
  164.         # switch to camera 2 with focus on ghost at indy's position
  165.         SetCameraFocus(2, startCam);
  166.         SetCameraSecondaryFocus(2, bossCamTarg);
  167.         SetCurrentCamera(2);
  168.         ResetCameraFOV(0, 0.0);
  169.         
  170.         # move the actor forward
  171.         AISetMoveSpeed(indyActor, 1.0);
  172.         AISetLookThingEyeLevel(indyActor, in_mv0);
  173.         AISetMoveThing(indyActor, in_mv0, 1);
  174.         
  175.         # play actors anims and line
  176.         Sleep(0.25);
  177.         track = PlayKey(indyActor, in_Stand4, 2, 0x0, 0);
  178.         PlayKey(indyActor, in_brush, 4, 0x12, 1);
  179.         PlayVoice(indyActor, in_what, 1.0, 0);
  180.         PlayKey(indyActor, in_hat, 4, 0x12, 0);
  181.         Sleep(1.0);
  182.  
  183.         # music cue
  184.         PlaySoundLocal(enter_cue, 1, 1, 0x0, 0);
  185.         
  186.         # detach the camtarget and move it up to the ice boss
  187.         DetachThing(bossCamTarg);
  188.         
  189.         # cam interps are on
  190.         SetCameraInterpSpeed(2, 2.0);
  191.         SetCameraLookInterp(2, 1);
  192.         Sleep(0.01);
  193.         
  194.         
  195.         # camera focus interps to ice boss
  196.         SetCameraSecondaryFocus(2, Ice_Boss); 
  197.         #animId = MoveThingToPos(bossCamTarg, GetThingPos(Ice_Boss), 2.0);
  198.         # camera position interps to  boss_shotPos
  199.         animId = MoveThingToPos(startCam, GetThingPos(boss_shotPos), 2.0);
  200.         SetCameraFOV(70, 1, 2);
  201.         Sleep(2.25);
  202.  
  203.         # cut camera look interping and begin his downward flipping
  204.         SetCameraLookInterp(2, 0);
  205.         #Sleep(1.0);
  206.         SetCameraFOV(90, 1, 1.0);
  207.         
  208.         SetActorFlags(Ice_Boss, 0x08);
  209.         DetachThing(Ice_Boss);
  210.  
  211.         Sleep(0.75);
  212.         # move cam down lower
  213.         animId = MoveThingToPos(startCam, GetThingPos(menace_shotPos), 1.0);
  214.         Sleep(1.0);
  215.         
  216.         # camera looks at menace shot targ 
  217.         SetCameraLookInterp(2, 1);
  218.         SetCameraInterpSpeed(2, 3);
  219.         Sleep(0.01);
  220.         SetCameraSecondaryFocus(2, menace_shotTarg);
  221. #        Sleep(1.0);
  222.        
  223.         # ice boss lands, and menaces indy
  224. #        SetPulse(0.1);    # world shakes
  225.         CopyorientAndPos(ib_mv1, Ice_Boss);
  226.         SendMessage(GetThingClassCog(Ice_Boss), USER2);            # Request 'dust cloud' VFX from actor COG
  227.         AISetLookThing(Ice_Boss, indyActor);
  228.         Sleep(1.0);
  229.         
  230.         # clear camera look interp
  231.         SetCameraLookInterp(2, 0);
  232.  
  233. #        SetPulse(0.0);
  234.  
  235.         # Play boss menace sequence
  236.         PlayMode(Ice_Boss, 61, 0);                                # Play 'crouch to stand' anim and wait
  237.  
  238.         SetCameraFOV(80, 1, 0.5);                                # Zoom in on the beast
  239.         Sleep(0.5);
  240.  
  241.         PlaySoundClass(Ice_Boss, 98);                            # Play 'roar' sound
  242.         PlayMode(Ice_Boss, 62, 1);                                # Play 'standing roar' anim
  243.  
  244.         PlayMode(Ice_Boss, 64, 0);                                # Play 'stand to crouch' anim
  245.         Sleep(0.5);
  246.         # cheat player towards the cross slightly
  247.         TeleportThing(player, in_mv1);
  248.         SetThingFlags(indyActor, 0x80000);
  249.         ClearThingFlags(player, 0x80000);
  250.  
  251.         # camera and control returns to player
  252.         
  253.         # Establish a camera position near Indy and prep follow-cam...            
  254.         v_targetpos = VectorAdd(VectorTransformToOrient(player, '0.25 -0.1 0.0'), GetThingPos(player));    
  255.         SetCameraPosition(1, v_targetpos);
  256.         SetCurrentCamera(1);
  257.         ResetCameraFOV(0, 0.0);
  258.         RestoreExtCam();
  259.         ClearActorFlags(player, 0x200000);
  260.         EndCutscene();
  261.  
  262.         Sleep(1.0);        # give the player a little safetytime
  263.  
  264.         # Destroy the cutscene boss
  265.         DestroyThing(Ice_Boss);
  266.  
  267.         # Request combat ice boss creation AI ice boss' actor cog at cutscene boss' position
  268.         t_CombatIceBoss = SendMessageEx(boss_Cog, USER0, ib_mv1, 0, 0, 0);
  269.         
  270.         # Put AI Boss "into play"
  271.         SendMessage(boss_Cog, USER1);
  272.  
  273.         # create target for secondary focus above the IceBoss
  274.         damageTarg = CreateThingAtPos(ghostTpl, GetThingSector(t_CombatIceBoss), VectorAdd(GetThingPos(t_CombatIceBoss),'0 0 0.15'), '0 0 0');    
  275.               
  276.         # create camera for focus above the player
  277.         damageCam = CreateThingAtPos(ghostTpl, GetThingSector(player), VectorAdd(GetThingPos(player),'0 0.0 0.15'), '0 0 0');
  278.     
  279.         # lock the objects to their 
  280.         AttachThingToThingEx(damageTarg, t_CombatIceBoss, 0x000C);
  281.         AttachThingToThingEx(damageCam, player, 0x000C);
  282.     }
  283. return;
  284.  
  285.  
  286. # ========================================================================================
  287. # KILLED recieved when the ice boss takes the final hit from IMP1.
  288. # ========================================================================================
  289. killed:
  290.  
  291.     # Boss AI cog notifies us of boss' defeat
  292.     if ( GetSenderRef() == boss_Cog )
  293.     {
  294.         # Prep boss for death cutscene
  295.         AISetCutsceneMode(t_CombatIceBoss);
  296.         StopThing(t_CombatIceBoss);
  297.  
  298.         # Start a little boss world camera shake
  299.         SendmessageEx(GetThingClassCog(t_CombatIceBoss), USER0, 20, 0, 0, 0);
  300.  
  301.         # player control and cam delay
  302.         StartCutscene(1);
  303.         SetActorFlags(player, 0x200000);
  304.         StopThing(player);
  305.         
  306.         SetPulse(0.01);
  307.         Sleep(0.75);
  308.         
  309.         
  310.         # SHOW THE CREATURE'S DEATH THROES
  311.         SetCameraFocus(2, damageCam);
  312.         SetCameraSecondaryFocus(2, t_CombatIceBoss);
  313.         # camera 2 look interp is on
  314.         SetCameraLookInterp(2,1);
  315.         SetCameraInterpSpeed(2, 1.0);
  316.         SetCurrentCamera(2);
  317.         SetThingFlags(player, 0x10);
  318.         Sleep(0.01);
  319.         SetCameraFOV(90, 0, 0.0);
  320.     
  321. #        SetPulse(0.01);
  322.         
  323.         Sleep(0.25);
  324.         # camera pans up with beast
  325.         SetCameraSecondaryFocus(2, damageTarg);
  326.         SetCameraFOV(100, 1, 1.0);
  327.         
  328.         # Begin boss death sequence
  329.         PlayMode(t_CombatIceBoss, 61, 1);                            # Play 'crouch to stand' anim and wait
  330.         PlayMode(t_CombatIceBoss, 20, 0);                            # Start the boss 'death' anim
  331.         
  332.         Sleep(2.0);
  333.         SetPulse(0.0);
  334.         # play death cue music
  335.         PlaySoundLocal(kill_cue, 1.0, 0.0, 0x0, 0);
  336.         Sleep(3.0);
  337.  
  338.         # Remove boss from game
  339.         DestroyThing(t_CombatIceBoss);
  340.  
  341.         Sleep(1.0);
  342.  
  343.         # show damage on the door
  344.         SetCameraLookInterp(2, 0);    # cut look interp
  345.         SetCameraFOV(120, 0, 0.0);
  346.         Sleep(0.01);
  347.         SetCameraSecondaryFocus(2, shatterTarg);
  348.         SetCameraFocus(2, crackshoCam);
  349.         SetCameraFOV(60, 1, 1.5);
  350.         SetPulse(0.1);
  351.         
  352.         crackloop=PlaySoundLocal(crackice, 0.5, 0, 0x0, 0);
  353.         materialanim(blockadeskin, 5, 0);
  354.         ChangeSoundVol(crackloop, 2, 1.0);
  355.         Sleep(1.0);
  356.         StopSound(crackloop, 0.25);
  357.         SetPulse(0.0);
  358.         Sleep(2.0);
  359.  
  360.         # restore the cam
  361.         Sleep(0.01);
  362.     
  363.     
  364.         # Establish a camera position near Indy and prep follow-cam...            
  365.         v_targetpos = VectorAdd(VectorTransformToOrient(player, '0.25 -0.1 0.05'), GetThingPos(player));    
  366.         SetCameraPosition(1, v_targetpos);
  367.     
  368.         # Drop into follow-cam mode...
  369.         ClearThingFlags(player, 0x10);
  370.         SetCurrentCamera(1);
  371.         ResetCameraFOV(0, 0.0);
  372.         RestoreExtCam();
  373.         Sleep(0.01);
  374.         EndCutscene();
  375.         ClearActorFlags(player, 0x200000);
  376.         # damage the barrier
  377.         i_shatterable = 3;
  378.         # clear the safety adjoin
  379.         SetSectorAdjoins(safetySECT, 1);
  380.     }
  381.  
  382.     return;
  383.  
  384.  
  385. # ========================================================================================
  386. # USER0 received when the player damages (but doesnt kill) the ice boss with IMP1
  387. # ========================================================================================
  388. user0:
  389.     
  390.     StopThing(t_CombatIceBoss);
  391.     AISetCutSceneMode(t_CombatIceBoss);
  392.  
  393.     SetActorFlags(player, 0x200000);
  394.     StartCutscene(1);
  395.     StopThing(player);
  396.     Sleep(0.5);
  397.     
  398.     # take player control
  399.     MakeMeStop();
  400.     
  401.     # show the damage to the creature
  402.     
  403.     #SetExtCamOffsetToThing(damageCam);
  404.     #Sleep(0.5);
  405.     #SetExtCamLookOffsetToThing(damageTarg);
  406.     
  407.     # creature scream and animation
  408.     #PlaySoundClass(t_CombatIceBoss, 98);                        # Play 'roar' sound
  409.     #PlayMode(t_CombatIceBoss, 62, 0);
  410.     
  411.     SetCameraFocus(2, damageCam);
  412.     SetCameraSecondaryFocus(2, t_CombatIceBoss);
  413.     # camera 2 look interp is on
  414.     SetCameraLookInterp(2,1);
  415.     SetCameraInterpSpeed(2, 1.0);
  416.     SetCurrentCamera(2);
  417.     SetThingFlags(player, 0x10);
  418.     Sleep(0.01);
  419.     SetCameraFOV(90, 0, 0.0);
  420. #    SetCameraFOV(80, 1, 0.5);
  421.  
  422. #    SetPulse(0.01);
  423.     
  424.     Sleep(0.5);
  425.     # camera pans up with beast
  426.     SetCameraSecondaryFocus(2, damageTarg);
  427.     SetCameraFOV(100, 1, 1.0);
  428.     
  429.     # creature scream and animation
  430.  
  431.     PlayMode(t_CombatIceBoss, 61, 1);                            # Play 'crouch to stand' anim and wait
  432.     PlaySoundClass(t_CombatIceBoss, 98);                        # Play 'roar' sound
  433.     PlayMode(t_CombatIceBoss, 62, 1);                              # Play 'standing roar' anim and wait
  434.     PlayMode(t_CombatIceBoss, 64, 0);                            # Play 'stand to crouch' anim and wait
  435.     Sleep(0.75);
  436.  
  437.     # restore the cam
  438.     SetCameraLookInterp(2, 0);    # cut look interp
  439.     ResetCameraFOV(0, 0.0);
  440.     Sleep(0.01);
  441.     
  442.     
  443.     # Establish a camera position near Indy and prep follow-cam...            
  444.     v_targetpos = VectorAdd(VectorTransformToOrient(player, '0.25 -0.1 0.0'), GetThingPos(player));    
  445.     SetCameraPosition(1, v_targetpos);
  446.  
  447.     # Drop into follow-cam mode...
  448.     ClearThingFlags(player, 0x10);
  449.     SetCurrentCamera(1);
  450.     RestoreExtCam();
  451.     ResetCameraFOV(0, 0.0);
  452.     Sleep(0.01);
  453.  
  454.     # restore control
  455.     EndCutscene();
  456.     ClearActorFlags(player, 0x200000);
  457.  
  458.     AIClearCutSceneMode(t_CombatIceBoss);
  459.  
  460.  
  461. return;
  462.  
  463.  
  464. # ========================================================================================
  465. pulse:
  466.  
  467.         SetPOVShake('0.0 0.0 0.005', '0.0 0.0 0.005', 80.0, 0.80);
  468.  
  469. return;
  470.  
  471.  
  472. # ========================================================================================
  473. damaged:
  474.  
  475.     If (GetSenderRef() != ice_barrier) return;
  476.     If (i_shatterable != 3) return;
  477.  
  478.     if(GetParam(1) == 0x1000)                        # IMP1 damage?
  479.     {
  480.         # do cutscene stuff
  481.         MakeMeStop();
  482.         StartCutscene(1);
  483.         
  484.         # interp camera
  485.         SetExtCamOffsetToThing(shatterCam);
  486.         
  487.         # start cameraShake
  488.         SetPulse(0.05);
  489.        
  490.         # alter fov for zoom-in effect
  491.         SetCameraFOV(70, 1, 2.5);
  492.         
  493.         # play temp sfx
  494.         PlaySoundLocal(sfxCharge, 1.0, 0.0, 0x0, 0);
  495.         
  496.         # light up the player
  497.         SetThingLight(shatterTarg, '0.25 0.55 1.0', 5.0, 2.0);
  498.         Sleep(1.0);
  499.  
  500.         # play explosion sfx
  501.         PlaySoundLocal(explosion, 1, 0, 0x0, 0);
  502.         
  503.         Sleep(1.0);
  504.         
  505.         # reset fov
  506.         ResetCameraFOV(0, 0.0);
  507.         
  508.         # kill dynamic light
  509.         SetThingLight(shatterTarg, '0.0 0.0 0.0', 5.0, 2.0);
  510.         
  511.         
  512.         # create the debris
  513.         for(i=0; i<8; i=i+1)                                                                        
  514.         {
  515.         fragment = CreateThing(debris, shatterTarg);                                 
  516.         SetThingVel(fragment, VectorScale(VectorAdd(RandVec(), '-0.5 -0.1 0.0'), 1));
  517.         SetThingRotVel(fragment, VectorScale(VectorAdd(RandVec(), '0.0 0.0 0.0'), 200.0));
  518.         Sleep(0.01);
  519.         }
  520.         
  521.         # kill the barrier
  522.         DestroyThing(ice_barrier);
  523.         
  524.         # stop the screenshake
  525.         SetPulse(0);
  526.  
  527.         # create and animate the dust sprite
  528.         SetMaterialCel(dustmat, 0);
  529.         MaterialAnim(dustmat, 8.0, 1);
  530.         dustthing = CreateThing(dust, shatterTarg);
  531.         AnimateSpriteSize(dustthing, duststart, dustend, 5.0);
  532.         
  533.         Sleep(1.0);
  534.         # indy sayline
  535.         PlayVoice(player, in_success, 1.0, 0);
  536.         
  537.         # rest for a bit
  538.         Sleep(0.5);
  539.         
  540.         # restore camera
  541.         RestoreExtCam();
  542.         SetCameraPosition(1, GetThingPos(shatterCam));
  543.         SetCurrentCamera(1);
  544.         
  545.         # restore controls
  546.         RestoreExtCam();
  547.         ResetCameraFOV(0, 0.0);
  548.         EndCutscene();
  549.         ClearActorFlags(player, 0x200000);
  550.         
  551.         # play music cue (temp?)
  552.         PlaySoundLocal(mus_Eerie, 1.0, 0.0, 0x0, 0);
  553.     }
  554.  
  555. return;
  556.  
  557.  
  558. end
  559.  
  560.  
  561.